package com.zhuhjay.app.web.controller.imchat;

import com.zhuhjay.common.base.controller.BaseController;
import com.zhuhjay.service.imchat.model.entity.ChatRoom;
import com.zhuhjay.service.imchat.service.ChatRoomService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author ZhuHJay
 * @since 2023-07-11
 */
@Api(tags = "聊天室")
@RestController
@RequestMapping("/chat/room")
public class ChatRoomController extends BaseController {

    @Resource
    private ChatRoomService roomService;

    @ApiOperation("获取聊天室列表")
    @GetMapping("/list")
    public List<ChatRoom> list() {
        return roomService.lambdaQuery().orderByDesc(ChatRoom::getUpdateTime).list();
    }

}
